package subversion;

import NewUI.Collumn;
import NewUI.Playlist;
import java.awt.BorderLayout;
import java.awt.Color;
import javax.swing.JFrame;
import javax.swing.JScrollPane;
import utils.KeyList;

/**
 * @author duncan
 */
public class Test_Playlist extends JFrame
{
    Playlist playlist	= new Playlist();
    Collumn c_index	= new Collumn("#");
    Collumn c_name	= new Collumn("Name");
    Collumn c_album	= new Collumn("Album");
    Collumn c_artist	= new Collumn("Artist");

    KeyList kl_album1	= new KeyList();
    KeyList kl_album2	= new KeyList();
    KeyList kl_album3	= new KeyList();
    KeyList kl_album4	= new KeyList();
    KeyList kl_album5	= new KeyList();

    JScrollPane sp_container = new JScrollPane(playlist);

    /**
     * Test_Playlist constructor.
     */
    public Test_Playlist()
    {
	setDefaultCloseOperation(EXIT_ON_CLOSE);
	setSize(640, 480);
	setVisible(true);

	setLayout(new BorderLayout());
	add(BorderLayout.CENTER, sp_container);
	playlist.setBackground(new Color(20, 20, 20));
	playlist.debugList();

	System.out.println("Added 4 headers named '#', 'Name, 'Album' and 'Artist'.");
	
	int i_index	= playlist.addHeader(c_index);
	int i_name	= playlist.addHeader(c_name);
	int i_album	= playlist.addHeader(c_album);
	int i_artist	= playlist.addHeader(c_artist);

	playlist.debugList();
	System.out.println("Added 5 items to the playlist.");
	playlist.addItem(kl_album1, 0);
	playlist.addItem(kl_album2, 1);
	playlist.addItem(kl_album3, 2);
	playlist.addItem(kl_album4, 3);
	playlist.addItem(kl_album5, 4);

	kl_album1.addKey("#", "1");
	kl_album1.addKey("Name", "Random Song");
	kl_album1.addKey("Album", "ShitSongs");
	kl_album1.addKey("Artist", "Emil");

	kl_album2.addKey("#", "2");
	kl_album2.addKey("Name", "WOloloSong");
	kl_album2.addKey("Album", "ShitSongs");
	kl_album2.addKey("Artist", "Emil and AoE");

	kl_album3.addKey("#", "3");
	kl_album3.addKey("Name", "FromHellWithCookies");
	kl_album3.addKey("Album", "Shit2Songs");
	kl_album3.addKey("Artist", "brb");

	kl_album4.addKey("#", "4");
	kl_album4.addKey("Name", "Lokomotive");
	kl_album4.addKey("Album", "Tågalbum");
	kl_album4.addKey("Artist", "Emil");

	kl_album5.addKey("#", "5");
	kl_album5.addKey("Name", "Rocket Launcher");
	kl_album5.addKey("Album", "Multiple Words");
	kl_album5.addKey("Artist", "Emil");

	System.out.println("Removed header: 'Jakob'.");
	playlist.debugList();
	playlist.repaint();
    }
}
